package books;

public class BookList {
    public Book[] books = new Book[10]; // 图书类数组
    public int usedSize;//存储当前书的个数

    // 无参构造：初始化Booklist
    // 存三本书
    public BookList(){
        books[0] = new Book("三国演义","罗贯中",68,"小说");
        books[1] = new Book("水浒传","施耐庵",68,"小说");
        books[2] = new Book("西游记","吴承恩",67,"小说");

        this.usedSize = 3;
    }

    // 获取当前存储的书的个数
    public int getUsedSize() {
        return usedSize;
    }

    //有效书的数量
    public void setUsedSize(int usedSize) {
        this.usedSize = usedSize;
    }

    // 返回book类数组的相应下标
    // 用于通过位置查找图书
    public Book getPos(int pos){
        return books[pos];
    }

    // 特定位置设置图书对象
    public void setBooks(Book book,int pos){
        books[pos] = book;
    }
}
